package com.indusfo.spc.controller;

import com.indusfo.spc.pojo.PlanOfflineList;
import com.indusfo.spc.service.PlanOfflineListService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author: 熊冰
 * @Date: 2019/11/11 10:29
 * 任务单维修采集参数
 */

@Controller
@RequestMapping("/planOfflineList")
public class PlanOfflineListController {
	@Autowired
	private PlanOfflineListService planOfflineListService;

	//查询
	@RequestMapping(value="/queryPlanOfflineList")
	@ResponseBody
	public JSONObject queryPlanOfflineList(PlanOfflineList planOfflineList) {
		JSONObject json = planOfflineListService.queryPlanOfflineList(planOfflineList);
		return json;
	}

	//新增
	@RequestMapping(value="/insertPlanOfflineList", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject insertPlanOfflineList(PlanOfflineList planOfflineList) {
		JSONObject json = planOfflineListService.insertPlanOfflineList(planOfflineList);
		return json;
	}

	//修改
	@RequestMapping(value = "/updatePlanOfflineList",method= RequestMethod.POST)
	@ResponseBody
	public JSONObject updatePlanOfflineList (PlanOfflineList planOfflineList){
		JSONObject json=planOfflineListService.updatePlanOfflineList(planOfflineList);
		return json;
	}

	//删除
	@RequestMapping(value="/deletePlanOfflineList", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject deletePlanOfflineList(@RequestParam("planOfflineListIds") List<Integer> planOfflineListIds, Integer dataState) {
		dataState = 2;
		JSONObject json = planOfflineListService.deletePlanOfflineList(planOfflineListIds, dataState);
		return json;
	}

	//启用
	@RequestMapping(value="/startPlanOfflineList", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject startPlanOfflineList(@RequestParam("planOfflineListIds") List<Integer> planOfflineListIds, Integer dataState) {
		dataState = 2;
		JSONObject json = planOfflineListService.deletePlanOfflineList(planOfflineListIds, dataState);
		return json;
	}

	//停用
	@RequestMapping(value="/stopPlanOfflineList", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject stopPlanOfflineList(@RequestParam("planOfflineListIds") List<Integer> planOfflineListIds, Integer dataState) {
		dataState = 2;
		JSONObject json = planOfflineListService.deletePlanOfflineList(planOfflineListIds, dataState);
		return json;
	}





}
